package com.gxa.service.impl.fwgl.yhgl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.gxa.mapper.fwgl.yhgl.CheckOutMapper;
import com.gxa.mapper.fwgl.yhgl.GooutMapper;
import com.gxa.pojo.dto.fwgl.NormalInDto;
import com.gxa.pojo.entity.fwgl.TCheckOut;
import com.gxa.pojo.entity.fwgl.TGoout;
import com.gxa.pojo.entity.fwgl.TOldinfo;
import com.gxa.service.fwgl.yhgl.GooutService;
import com.gxa.utils.QueryResult;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author：lizhijun
 * @Package：{PROJECT_NAME}
 * @name：{DATE} {NAME}
 */
@Service
public class GooutServiceImpl implements GooutService {
    @Resource
    private GooutMapper gooutMapper;
    @Override
    public QueryResult queryAll(NormalInDto normalInDto) {
        Page<TGoout> page = PageHelper.startPage(normalInDto.getPage(),normalInDto.getLimit());
        List<TGoout> checkOutList = gooutMapper.queryAll(normalInDto);
        QueryResult queryResult = new QueryResult();
        queryResult.setCount(page.getTotal());
        queryResult.setData(checkOutList);
        return queryResult;
    }

    @Override
    public void add(TGoout goout) {
        gooutMapper.insertGoout(goout);
    }

    @Override
    public void update(TGoout goout) {
         gooutMapper.updateGoout(goout);
    }

    @Override
    public void delete(int id) {
       gooutMapper.deleteGoout(id);
    }

    @Override
    public TOldinfo findByName(String patientName) {
        return null;
    }
}
